Maximum C++

By Mark Box, Vice President, Sales and Marketing

"zApp is more object-oriented than other frameworks."

We hear this comment frequently at Inmark, and recently I had the chance to talk to a number of our customers about what they mean by this.

These developers gave us a number of specific examples of how zApp is better than products that attempt to achieve object-oriented capabilities by creating a C++ wrapper around their C-based products. zApp was designed from the beginning as a C++ framework to take advantage of the built-in object oriented capabilities of C++.

The zApp product family was created as a result of Inmark's need to have a better means of developing cross-platform applications for the financial industry. Because of this, we built an object-oriented framework that models the way developers actually need to use objects. This gives our framework a number of key advantages:

Usability: The zApp framework is easy to use because the objects correspond to tasks that developers need.

Extensibility and Maintainability: The structure of a zApp application is intuitive, easy to understand, and readily extensible because the objects model usage.

Performance: zApp applications have superior performance because there is no extra layer wrapping another set of functions.

C++ was the language chosen for implementation, because its data abstraction capabilities allowed a higher level interface to be designed with no loss in flexibility. This results in the ability to write applications in less code than using C-based tools, but with equal efficiency. Additionally, the ability to inline functions means that, where appropriate, functions can map directly to underlying system calls with no extra function call overhead. This is especially important in areas such as graphics subsystems.

Here are a few examples of zApp's object-oriented structure that really set it apart. While no few features will show the depth of zApp, they will give you a feel of how it works.

It's the Objects

Unlike other frameworks, zApp doesn't use complex macros for object construction and event handling. Our programming interface is almost exclusively through standard C++ objects. zApp's objects encapsulate lots of core functionality, and they're often modeled after "real" objects.

How does a kid draw a picture? She dumps the crayons onto the table, grabs one, and has at it. If she wants a different color or size, she swaps crayons and continues drawing. zPens and zBrushes work the same way. You can construct them anywhere, not just within a paint event, and it isn't necessary to destroy one to create another. Unlike other APIs, zApp's approach to graphics accurately reflects the real world, and that makes programming intuitive.

Powerful Frame/Panes

zApp divides "windows" into two parts, frames and panes. A frame is the border around a window, which can include a caption, maximize and minimize boxes, and a menu. If a window requires output, it uses a separate display class called a pane. This design makes code easier to recycle. Once a user has created a custom pane -- for example, one that accepts mouse input for drawing -- he can reuse it in any application.

What is great is that this same architectual setup also simplifies printing. In a WYSIWYG environment, you don't want to print the window -- complete with a system box and a caption -- just what's inside. In other words, you print the pane. All you do is redirect the pane's output to the printer device, and out it comes. No extra printing calls are required. Everyone knows that less codes makes applications easier to write, read, and maintain.

Flexible Formatters

Not only are our objects powerful, they are extremely flexible. Consider zFormatters. The most obvious OOP solution to formatting an edit line would be to create a family of edit lines, each inheriting basic functionality and adding validation features. You'd have a zUpperStringEdit, a zLowerStringEdit, a zMaskStringEdit, and so on.

We chose a different tack. We created a family of formatter objects to handle masking and validation tasks. Depending on the parameter passed in the zStringEdit constructor, a different zFormatter is chosen. The advantage became apparent when we were designing our new zTable object. Because zFormatter are generic objects, they work with table cells exactly like they do with edit controls. No extra work was required to give our table object validation and formatting capabilities.

Event Handling Made Easy...and Fun!

Perhaps zApp's slickest design feature is its event handling system. zApp encapsulates all standard messages so into the base event class, zEvent, and its derived classes, zDrawEvt, zKeyEvt, zMouseClickEvt, etc. That saves programmers the drudgery of message mapping. It's possible to override the default behavior of any common event by overriding a virtual function, and you can reroute events to other objects, even to non-window objects. For example, if an application needed a very complex mouse interface, you could send the mouse events to a separate date object for processing, even at runtime. That's real flexibility.

Overall Class Design

The power, flexibility, reusability, and intuitiveness of objects is not the only important aspect of a class library. You should look at how the objects are organized. What is the overall class design?

Instead of a monolithic structure, we provide several independent class hierarchies. Though on the surface that may appear less object-oriented than other software, the opposite is true. It is more efficient because developers can mix and match the objects they need without pulling in unnecessary code.

Conclusion

Highlighting a few of zApp's classes can give only a brief glimpse into its object-oriented finesse.

The only way to really experience the elegance of zApp's design is to use it. Spend a few hours rooting around in the source code and you'll find countless other examples of how we exploit the possibilities of object-oriented programming.


Previous Newsletter Page


If you have additional questions, please feel free to contact zApp Technical Support.

© Copyright 1995, Rogue Wave Software, Inc.